#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<algorithm>

using namespace std;

const int N = 100010;

typedef long long LL;

int n;
int a[N], b[N], c[N], t[N];

int work(int* x, int* y, int* z)
{
    for (int j = 0; j < n; j++)    t[j] = x[j] - y[j] - z[j];
    sort(t, t + n, greater<int>());
    LL sum = 0;
    int res = -1;
    for (int j = 0; j < n; j++)
    {
        sum += t[j];
        if (sum <= 0) break;
        res = j + 1;
    }
    return res;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)    scanf("%d", &a[i]);
    for (int i = 0; i < n; i++)    scanf("%d", &b[i]);
    for (int i = 0; i < n; i++)    scanf("%d", &c[i]);

    int res = max({ work(a,b,c),work(b,a,c),work(c,a,b) });
    printf("%d\n", res);
    return 0;
}

//#include<iostream>
//#include<cstring>
//
//using namespace std;
//
//const int N = 1000010;
//
//char s[N];
//int f[N][2];
//
//int main()
//{
//    scanf("%s", s + 1);
//    int n = strlen(s + 1);
//
//    for (int i = 1; i <= n; i++)
//    {
//        f[i][0] = max(f[i - 1][0], f[i - 1][1]);
//        f[i][1] = f[i - 1][0] + s[i] - 'a' + 1;
//    }
//    printf("%d\n", max(f[n][0], f[n][1]));
//    return 0;
//}